package com.example.entity;


import lombok.Builder;
import lombok.Data;

@Data
@Builder
public class R {
    private Integer code;//响应值
    private String msg;
    private Long total;//数据条数
    private Object data;

    public static R ok(String msg){
        return R.builder().code(200).msg("msg").build();
    }

    public static R error(String msg){
         return R.builder().code(201).msg(msg).build();
    }

    public static R data(Object data){
        return R.builder().code(200).data(data).build();
    }

    public static R page(Long total,Object data){
        return R.builder().code(200).data(data).total(total).build();
    }

}
